

/**
 * @author antonio081014
 * @time Jul 5, 2013, 9:31:32 PM
 */
public class Node<T extends Comparable<T>> implements Comparable<Node<T>> {

 private T data;
 private Node<T> left;
 private Node<T> right;
 public int level;

 public Node(T data) {
  this(data, null, null);
 }

 public Node(T data, Node<T> left, Node<T> right) {
  super();
  this.data = data;
  this.left = left;
  this.right = right;
 }

 public T getData() {
  return data;
 }

 public void setData(T data) {
  this.data = data;
 }

 public Node<T> getLeft() {
  return left;
 }

 public void setLeft(Node<T> left) {
  this.left = left;
 }

 public Node<T> getRight() {
  return right;
 }

 public void setRight(Node<T> right) {
  this.right = right;
 }

 @Override
 public int compareTo(Node<T> o) {
  return this.data.compareTo(o.data);
 }

 @Override
 public String toString() {
  return "Level " + level + ": " + data.toString();
 }

}